home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
misc
/
amag
/
12b92.lha
/
Tips & Tricks
/
Busy Pointer (C, BASIC)
/
ClockPointer.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-02
|
2KB
|
77 lines
/*
ClockPointer.c - verwandelt den Mauszeiger in eine Uhr
Aufruf mit Aztec V3.6: cc ClockPointer.c +l
ln ClockPointer.o -lc32
ClockPointer
*/
#include <functions.h>
#include <exec/memory.h>
#include <graphics/view.h>
#include <intuition/intuitionbase.h>
#include <hardware/cia.h>
struct GfxBase *GfxBase;
struct IntuitionBase *IntuitionBase;
struct ViewPort *ViewPort;
struct Window *Window;
USHORT *Pointer;
ULONG col1,col2,col3;
USHORT PointerData[]= /* Daten des Uhr-Mauszeigers */
{
0,0,
0x0,0x7C0, 0x0,0x100, 0x0,0x7C0,
0x7C0,0x1830, 0x1FF0,0x2108, 0x3FF8,0x4104,
0x3FF8,0x4104, 0x7FFC,0x8102, 0x7FFC,0x8102,
0x7FFC,0x81F2, 0x7FFC,0x8002, 0x7FFC,0x8002,
0x3FF8,0x4004, 0x3FF8,0x4004, 0x1FF0,0x2008,
0x7C0,0x1830, 0x0,0x7C0, 0x0,0x820,
0x0,0x1830
};
BOOL SetClockPointer(Window) /* setzten des Uhr-Mauszeigers */
struct Window *Window;
{
if (Pointer=AllocMem(sizeof(PointerData),MEMF_CHIP))
{
ViewPort=(struct ViewPort *)ViewPortAddress(Window);
col1=GetRGB4(ViewPort->ColorMap,17); /* Farben des alten Zeigers retten */
col2=GetRGB4(ViewPort->ColorMap,18);
col3=GetRGB4(ViewPort->ColorMap,19);
SetRGB4(ViewPort,17,15,15,15); /* Farben für neuen Zeiger setzen */
SetRGB4(ViewPort,18,2,3,11);
SetRGB4(ViewPort,19,1,2,4);
CopyMem(PointerData,Pointer,sizeof(PointerData)); /* Daten ins Chip Mem */
SetPointer(Window,Pointer,18,16,1,1); /* Pointer setzen */
return(1);
}
return(0);
}
void ClearClockPointer(Window) /* alten Zeiger wieder herstellen */
struct Window *Window;
{
ClearPointer(Window); /* eigenen Zeiger löschen */
SetRGB4(ViewPort,17,(col1>>8)&15,(col1>>4)&15,col1&15);
SetRGB4(ViewPort,18,(col2>>8)&15,(col2>>4)&15,col2&15);
SetRGB4(ViewPort,19,(col3>>8)&15,(col3>>4)&15,col3&15);
FreeMem(Pointer,sizeof(PointerData)); /* Speicher freigeben */
}
void main()
{
IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0);
GfxBase=(struct GfxBase *)OpenLibrary("graphics.library",0);
if (IntuitionBase && GfxBase)
{
Window=IntuitionBase->ActiveWindow;
if (SetClockPointer(Window)) /* Uhr-Mauszeiger setzen */
{
puts("Warten beenden mit Mausklick !");
while (ciaa.ciapra&64); /* auf MausKlick warten */
ClearClockPointer(Window); /* Uhr-Mauszeiger löschen */
}
}
if (IntuitionBase) CloseLibrary(IntuitionBase);
if (GfxBase) CloseLibrary(GfxBase);
}